﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.BMQ
{
    /// <summary>
    /// BMQ消息接口
    /// </summary>
    public interface IBMQMessage
    {
        /// <summary>
        /// BMQ消息类型
        /// </summary>
        byte MessageType { get; }

        /// <summary>
        /// 消息生成进二进制buffer
        /// </summary>
        /// <returns>二进制buffer</returns>
        byte[] ToBytes();

        /// <summary>
        /// 消息生成进TLV二进制buffer
        /// </summary>
        /// <returns>二进制buffer</returns>
        byte[] ToTLVBytes();

        /// <summary>
        /// 读取消息到对象
        /// </summary>
        /// <param name="buffer">完整消息buffer</param>
        void FromBytes(byte[] buffer);

        /// <summary>
        /// 关闭缓冲区
        /// </summary>
        void Close();

    }
}
